1. Field of the Invention
Embodiments of the present invention generally relate to computer science and, more specifically, to an application programming interface (API) that includes server-executed client-based code.
2. Description of the Related Art
In a traditional API model, the network serves as a hard boundary between a client application and an API server tier. The API server tier provides a generalized interface for accessing certain data resources to all types of client applications. Each client application may request these generalized data resources from the API server tier. By providing a generalized interface, the traditional API server tier establishes a clear set of rules that allow many different client applications potentially running on dissimilar devices to retrieve the same data resources in the same manner.
Computing devices have proliferated in recent years and many companies would like to provide their content to as many different devices as possible. Oftentimes this results in client applications being built specifically for each device. Across these myriad devices there is a high degree of variability in functionality, including from game consoles, TVs, set-top boxes, smartphones, etc. This variability of functionality results in a divergence in the data resource requirements of the client applications specific to the different devices. For instance, different devices may have different memory capacity, may require a unique or proprietary format or delivery method, or may have different screen real estate sizes. Although a client application may require specific data in a specific format, the API server tier only provides the generalized data resources. For instance, an API server tier providing access to movie information may respond to all requests for suggested movie titles with a generalized data resource containing 100 movie titles, regardless of how many movie titles a particular client application actually displays on a device or what data formats are required by the device. As the number of different types of client applications running on these different devices continues to expand, the traditional API model of generalized data resources poses significant development challenges.
Although APIs built with the traditional model may not be optimized for the specific client applications, the client applications may extract the data from the generalized data resources. However, this data extraction can cause significant inefficiencies. Different client applications may perform large numbers of requests to retrieve the required data, which consumes network bandwidth. Furthermore, to gather the required content, the same or different client applications may request, receive, and then discard significant amounts of extra data. For instance, a client application running on a mobile device may receive 100 movie titles from an API, but only display five movie titles, so the other 95 movie titles are simply discarded. These inefficiencies may result in network latencies, which could cause an application to load or respond slowly.
Furthermore, the development and maintenance of a traditional API that supports myriad client applications can become increasingly difficult. As the number of client applications increases, the number of different requirements increases. Supporting an increasing number of requirements consumes more development time and resources and/or delays client application production. For instance, if a new device requires data in a unique format, then API development resources have to be diverted to create new data resources for the device. Likewise, the production of a client application for the device may be delayed until the API is appropriately updated to accommodate the unique data format.
As the foregoing illustrates, there remains a need for more effective techniques for providing data resources optimized for an expanding number of different client applications.